package com.springboot.service.impl;

import com.springboot.mapper.OrderFormMapper;
import com.springboot.mapper.UserLoginFormMapper;
import com.springboot.model.OrderForm;
import com.springboot.model.UserLoginForm;
import com.springboot.service.DoctorViewAllPatientListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class DoctorViewAllPatientListServiceImpl implements DoctorViewAllPatientListService {
    @Autowired
    private UserLoginFormMapper userLoginFormMapper;

    @Autowired
    private OrderFormMapper orderFormMapper;

    //通过手机号查找医生
    @Override
    public UserLoginForm findDoctorByTel(String tel)
    {
        UserLoginForm userLoginForm=userLoginFormMapper.selectByTel(tel);
        return userLoginForm;
    }

    //通过医生id查找预约记录
    @Override
    public ArrayList<OrderForm> findOrderByDoctorId(Integer doctorId)
    {
        ArrayList<OrderForm> orderForms=orderFormMapper.selectByDoctorId(doctorId);
        return orderForms;
    }

    //通过用户id查找患者
    @Override
    public UserLoginForm findPatientByUserId(Integer userId)
    {
        return userLoginFormMapper.selectByPrimaryKey(userId);
    }
}
